package com.jfok.shared;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.jfok.server.hibernate.system._MenuGroup;
import com.jfok.server.hibernate.system._Module;
import com.jfok.server.hibernate.system._ModuleField;
import com.jfok.server.hibernate.system._ReportGroup;
import com.jfok.server.hibernate.systemset._UserFieldHiddenRoleDetail;
import com.jfok.server.hibernate.systemset._UserFieldReadonlyRoleDetail;
import com.jfok.server.hibernate.systemset._UserRoleDetail;


@SuppressWarnings("serial")
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class SystemAndLoginInfo implements Serializable {

	private String tf_systemName;
	private String tf_systemVersion;
	private String tf_systemAddition;

	private Integer tf_userId;
	private String tf_loginName;
	private String tf_userName;
	private String tf_departmentId = null;
	private String tf_departmentName = null;

	private String tf_userdwmc;
	private Date tf_userStartdate;

	private String tf_serviceDepartment;
	private String tf_serviceMen;
	private String tf_serviceTelnumber;
	private String tf_serviceFaxnumber;
	private String tf_serviceEmail;
	private String tf_serviceHomepage;
	private String tf_serviceQQ;
	private String tf_copyrightOwner;
	private String tf_copyrightInfo;

	private Integer tf_additionFileMaxMB;
	private String tf_previewExts;    //可预览的文件的后缀名 ，用逗号分开

	private Set<_Module> tf_Modules; // 系统模块定义信息，登录成功，则传过来
	private List<_UserRoleDetail> tf_userRoleDetails; // 用户的权限信息
	private List<_UserFieldHiddenRoleDetail> tf_userFieldHiddenRoleDetails; // 字段角色中加入的不隐藏的字段
	private List<_UserFieldReadonlyRoleDetail> tf_userFieldReadonlyRoleDetails; // 字段角色中加入的不隐藏的字段

	private List<_MenuGroup> tf_MenuGroups; // 系统菜单
	private List<_ReportGroup> tf_ReportGroups;  //综合查询的分组
	
	// private List<Module> menuModules;
	// private List<ApproveModuleInfo> approveModuleInfos; //系统审批的模块以及可以审批的人员

	public SystemAndLoginInfo() {
	}

	
	public _Module getModuleWithName(String moduleName) {
		for (_Module m : getTf_Modules())
			if (m.getTf_moduleName().equals(moduleName))
				return m;
		return null;
	}

	
	public _Module getModuleWithId(String moduleId) {
		for (_Module m : getTf_Modules())
			if (m.getTf_moduleId().equals(moduleId))
				return m;
		return null;
	}

	
	public _Module getModuleWithAsName(String asName) {
		for (_Module m : getTf_Modules())
			if (m.getTableAsName().equals(asName))
				return m;
		return null;
	}

	
	public _ModuleField getModuleFieldWithId(Integer fieldid) {
		for (_Module module : tf_Modules)
			for (_ModuleField field : module.getModuleFields())
				if (field.getTf_fieldId().equals(fieldid)) {
					field.setTf_Module(module);
					return field;
				}
		return null;
	}

	public String getModuleTitles(String[] moduleNames, String sepetator) {
		String result = "";
		for (String name : moduleNames) {
			result += getModuleWithName(name).getTf_title()
					+ (name.equals(moduleNames[moduleNames.length - 1]) ? "" : sepetator);
		}
		return result;
	}

	public String getTf_systemName() {
		return tf_systemName;
	}

	public void setTf_systemName(String tf_systemName) {
		this.tf_systemName = tf_systemName;
	}

	public String getTf_systemVersion() {
		return tf_systemVersion;
	}

	public void setTf_systemVersion(String tf_systemVersion) {
		this.tf_systemVersion = tf_systemVersion;
	}

	public String getTf_systemAddition() {
		return tf_systemAddition;
	}

	public void setTf_systemAddition(String tf_systemAddition) {
		this.tf_systemAddition = tf_systemAddition;
	}

	public Integer getTf_userId() {
		return tf_userId;
	}

	public void setTf_userId(Integer tf_userId) {
		this.tf_userId = tf_userId;
	}

	public String getTf_loginName() {
		return tf_loginName;
	}

	public void setTf_loginName(String tf_loginName) {
		this.tf_loginName = tf_loginName;
	}

	public String getTf_userName() {
		return tf_userName;
	}

	public void setTf_userName(String tf_userName) {
		this.tf_userName = tf_userName;
	}

	public String getTf_userdwmc() {
		return tf_userdwmc;
	}

	public void setTf_userdwmc(String tf_userdwmc) {
		this.tf_userdwmc = tf_userdwmc;
	}

	public Date getTf_userStartdate() {
		return tf_userStartdate;
	}

	public void setTf_userStartdate(Date tf_userStartdate) {
		this.tf_userStartdate = tf_userStartdate;
	}

	public String getTf_serviceDepartment() {
		return tf_serviceDepartment;
	}

	public void setTf_serviceDepartment(String tf_serviceDepartment) {
		this.tf_serviceDepartment = tf_serviceDepartment;
	}

	public String getTf_serviceMen() {
		return tf_serviceMen;
	}

	public void setTf_serviceMen(String tf_serviceMen) {
		this.tf_serviceMen = tf_serviceMen;
	}

	public String getTf_serviceTelnumber() {
		return tf_serviceTelnumber;
	}

	public void setTf_serviceTelnumber(String tf_serviceTelnumber) {
		this.tf_serviceTelnumber = tf_serviceTelnumber;
	}

	public String getTf_serviceFaxnumber() {
		return tf_serviceFaxnumber;
	}

	public void setTf_serviceFaxnumber(String tf_serviceFaxnumber) {
		this.tf_serviceFaxnumber = tf_serviceFaxnumber;
	}

	public String getTf_serviceEmail() {
		return tf_serviceEmail;
	}

	public void setTf_serviceEmail(String tf_serviceEmail) {
		this.tf_serviceEmail = tf_serviceEmail;
	}

	public String getTf_serviceHomepage() {
		return tf_serviceHomepage;
	}

	public void setTf_serviceHomepage(String tf_serviceHomepage) {
		this.tf_serviceHomepage = tf_serviceHomepage;
	}

	public String getTf_serviceQQ() {
		return tf_serviceQQ;
	}

	public void setTf_serviceQQ(String tf_serviceQQ) {
		this.tf_serviceQQ = tf_serviceQQ;
	}

	public String getTf_copyrightOwner() {
		return tf_copyrightOwner;
	}

	public void setTf_copyrightOwner(String tf_copyrightOwner) {
		this.tf_copyrightOwner = tf_copyrightOwner;
	}

	public String getTf_copyrightInfo() {
		return tf_copyrightInfo;
	}

	public void setTf_copyrightInfo(String tf_copyrightInfo) {
		this.tf_copyrightInfo = tf_copyrightInfo;
	}

	public String getTf_departmentId() {
		return tf_departmentId;
	}

	public void setTf_departmentId(String tf_departmentId) {
		this.tf_departmentId = tf_departmentId;
	}

	public String getTf_departmentName() {
		return tf_departmentName;
	}

	public void setTf_departmentName(String tf_departmentName) {
		this.tf_departmentName = tf_departmentName;
	}

	public Set<_Module> getTf_Modules() {
		return tf_Modules;
	}

	public void setTf_Modules(Set<_Module> tf_Modules) {
		this.tf_Modules = tf_Modules;
	}

	public List<_MenuGroup> getTf_MenuGroups() {
		return tf_MenuGroups;
	}

	public void setTf_MenuGroups(List<_MenuGroup> tf_MenuGroups) {
		this.tf_MenuGroups = tf_MenuGroups;
	}

	public Integer getTf_additionFileMaxMB() {
		return tf_additionFileMaxMB;
	}

	public void setTf_additionFileMaxMB(Integer tf_additionFileMaxMB) {
		this.tf_additionFileMaxMB = tf_additionFileMaxMB;
	}

	public List<_UserRoleDetail> getTf_userRoleDetails() {
		return tf_userRoleDetails;
	}

	public void setTf_userRoleDetails(List<_UserRoleDetail> tf_userRoleDetails) {
		this.tf_userRoleDetails = tf_userRoleDetails;
	}

	public List<_UserFieldHiddenRoleDetail> getTf_userFieldHiddenRoleDetails() {
		return tf_userFieldHiddenRoleDetails;
	}

	public void setTf_userFieldHiddenRoleDetails(
			List<_UserFieldHiddenRoleDetail> tf_userFieldHiddenRoleDetails) {
		this.tf_userFieldHiddenRoleDetails = tf_userFieldHiddenRoleDetails;
	}

	public List<_UserFieldReadonlyRoleDetail> getTf_userFieldReadonlyRoleDetails() {
		return tf_userFieldReadonlyRoleDetails;
	}

	public void setTf_userFieldReadonlyRoleDetails(
			List<_UserFieldReadonlyRoleDetail> tf_userFieldReadonlyRoleDetails) {
		this.tf_userFieldReadonlyRoleDetails = tf_userFieldReadonlyRoleDetails;
	}

	public List<_ReportGroup> getTf_ReportGroups() {
		return tf_ReportGroups;
	}

	public void setTf_ReportGroups(List<_ReportGroup> tf_ReportGroups) {
		this.tf_ReportGroups = tf_ReportGroups;
	}

	public String getTf_previewExts() {
		return tf_previewExts;
	}

	public void setTf_previewExts(String tf_previewExts) {
		this.tf_previewExts = tf_previewExts;
	}

}
